

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="Description" content="scikit-learn: machine learning in Python">

  
  <title>sklearn.inspection.plot_partial_dependence &mdash; scikit-learn 0.22 documentation</title>
  
  <link rel="canonical" href="http://scikit-learn.org/stable/modules/generated/sklearn.inspection.plot_partial_dependence.html" />

  
  <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  <link rel="stylesheet" href="../../_static/css/vendor/bootstrap.min.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/gallery.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script> 
</head>
<body>
<nav id="navbar" class="sk-docs-navbar navbar navbar-expand-md navbar-light bg-light py-0">
  <div class="container-fluid sk-docs-container px-0">
      <a class="navbar-brand py-0" href="../../index.html">
        <img
          class="sk-brand-img"
          src="../../_static/scikit-learn-logo-small.png"
          alt="logo"/>
      </a>
    <button
      id="sk-navbar-toggler"
      class="navbar-toggler"
      type="button"
      data-toggle="collapse"
      data-target="#navbarSupportedContent"
      aria-controls="navbarSupportedContent"
      aria-expanded="false"
      aria-label="Toggle navigation"
    >
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="sk-navbar-collapse collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../install.html">Install</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../user_guide.html">User Guide</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../classes.html">API</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../auto_examples/index.html">Examples</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../getting_started.html">Getting Started</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../tutorial/index.html">Tutorial</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../glossary.html">Glossary</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../developers/index.html">Development</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../faq.html">FAQ</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../related_projects.html">Related packages</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../roadmap.html">Roadmap</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../about.html">About us</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://github.com/scikit-learn/scikit-learn">GitHub</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://scikit-learn.org/dev/versions.html">Other Versions</a>
        </li>
        <li class="nav-item dropdown nav-more-item-dropdown">
          <a class="sk-nav-link nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">More</a>
          <div class="dropdown-menu" aria-labelledby="navbarDropdown">
              <a class="sk-nav-dropdown-item dropdown-item" href="../../getting_started.html">Getting Started</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../tutorial/index.html">Tutorial</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../glossary.html">Glossary</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../developers/index.html">Development</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../faq.html">FAQ</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../related_projects.html">Related packages</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../roadmap.html">Roadmap</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../about.html">About us</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="https://github.com/scikit-learn/scikit-learn">GitHub</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="https://scikit-learn.org/dev/versions.html">Other Versions</a>
          </div>
        </li>
      </ul>
      <div id="searchbox" role="search">
          <div class="searchformwrapper">
          <form class="search" action="../../search.html" method="get">
            <input class="sk-search-text-input" type="text" name="q" aria-labelledby="searchlabel" />
            <input class="sk-search-text-btn" type="submit" value="Go" />
          </form>
          </div>
      </div>
    </div>
  </div>
</nav>
<div class="d-flex" id="sk-doc-wrapper">
    <input type="checkbox" name="sk-toggle-checkbox" id="sk-toggle-checkbox">
    <label id="sk-sidemenu-toggle" class="sk-btn-toggle-toc btn sk-btn-primary" for="sk-toggle-checkbox">Toggle Menu</label>
    <div id="sk-sidebar-wrapper" class="border-right">
      <div class="sk-sidebar-toc-wrapper">
        <div class="sk-sidebar-toc-logo">
          <a href="../../index.html">
            <img
              class="sk-brand-img"
              src="../../_static/scikit-learn-logo-small.png"
              alt="logo"/>
          </a>
        </div>
        <div class="btn-group w-100 mb-2" role="group" aria-label="rellinks">
            <a href="sklearn.inspection.PartialDependenceDisplay.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.inspection.PartialDependenceDisplay">Prev</a><a href="../classes.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="API Reference">Up</a>
            <a href="sklearn.isotonic.IsotonicRegression.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.isotonic.IsotonicRegression">Next</a>
        </div>
        <div class="alert alert-danger p-1 mb-2" role="alert">
          <p class="text-center mb-0">
          <strong>scikit-learn 0.22</strong><br/>
          <a href="http://scikit-learn.org/dev/versions.html">Other versions</a>
          </p>
        </div>
        <div class="alert alert-warning p-1 mb-2" role="alert">
          <p class="text-center mb-0">
            Please <a class="font-weight-bold" href="../../about.html#citing-scikit-learn"><string>cite us</string></a> if you use the software.
          </p>
        </div>
          <div class="sk-sidebar-toc">
            <ul>
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.inspection</span></code>.plot_partial_dependence</a><ul>
<li><a class="reference internal" href="#examples-using-sklearn-inspection-plot-partial-dependence">Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.inspection.plot_partial_dependence</span></code></a></li>
</ul>
</li>
</ul>

          </div>
      </div>
    </div>
    <div id="sk-page-content-wrapper">
      <div class="sk-page-content container-fluid body px-md-3" role="main">
        
  <div class="section" id="sklearn-inspection-plot-partial-dependence">
<h1><a class="reference internal" href="../classes.html#module-sklearn.inspection" title="sklearn.inspection"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.inspection</span></code></a>.plot_partial_dependence<a class="headerlink" href="#sklearn-inspection-plot-partial-dependence" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="sklearn.inspection.plot_partial_dependence">
<code class="sig-prename descclassname">sklearn.inspection.</code><code class="sig-name descname">plot_partial_dependence</code><span class="sig-paren">(</span><em class="sig-param">estimator</em>, <em class="sig-param">X</em>, <em class="sig-param">features</em>, <em class="sig-param">feature_names=None</em>, <em class="sig-param">target=None</em>, <em class="sig-param">response_method='auto'</em>, <em class="sig-param">n_cols=3</em>, <em class="sig-param">grid_resolution=100</em>, <em class="sig-param">percentiles=(0.05</em>, <em class="sig-param">0.95)</em>, <em class="sig-param">method='auto'</em>, <em class="sig-param">n_jobs=None</em>, <em class="sig-param">verbose=0</em>, <em class="sig-param">fig=None</em>, <em class="sig-param">line_kw=None</em>, <em class="sig-param">contour_kw=None</em>, <em class="sig-param">ax=None</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/inspection/_partial_dependence.py#L416"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.inspection.plot_partial_dependence" title="Permalink to this definition">¶</a></dt>
<dd><p>Partial dependence plots.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">len(features)</span></code> plots are arranged in a grid with <code class="docutils literal notranslate"><span class="pre">n_cols</span></code>
columns. Two-way partial dependence plots are plotted as contour plots. The
deciles of the feature values will be shown with tick marks on the x-axes
for one-way plots, and on both axes for two-way plots.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p><a class="reference internal" href="#sklearn.inspection.plot_partial_dependence" title="sklearn.inspection.plot_partial_dependence"><code class="xref py py-func docutils literal notranslate"><span class="pre">plot_partial_dependence</span></code></a> does not support using the same axes
with multiple calls. To plot the the partial dependence for multiple
estimators, please pass the axes created by the first call to the
second call:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.inspection</span> <span class="kn">import</span> <span class="n">plot_partial_dependence</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.datasets</span> <span class="kn">import</span> <span class="n">make_friedman1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.linear_model</span> <span class="kn">import</span> <span class="n">LinearRegression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">X</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">make_friedman1</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">est</span> <span class="o">=</span> <span class="n">LinearRegression</span><span class="p">()</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">X</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">disp1</span> <span class="o">=</span> <span class="n">plot_partial_dependence</span><span class="p">(</span><span class="n">est</span><span class="p">,</span> <span class="n">X</span><span class="p">)</span>  
<span class="gp">&gt;&gt;&gt; </span><span class="n">disp2</span> <span class="o">=</span> <span class="n">plot_partial_dependence</span><span class="p">(</span><span class="n">est</span><span class="p">,</span> <span class="n">X</span><span class="p">,</span>
<span class="gp">... </span>                                <span class="n">ax</span><span class="o">=</span><span class="n">disp1</span><span class="o">.</span><span class="n">axes_</span><span class="p">)</span>  
</pre></div>
</div>
</div>
<p>Read more in the <a class="reference internal" href="../partial_dependence.html#partial-dependence"><span class="std std-ref">User Guide</span></a>.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>estimator</strong><span class="classifier">BaseEstimator</span></dt><dd><p>A fitted estimator object implementing <a class="reference internal" href="../../glossary.html#term-predict"><span class="xref std std-term">predict</span></a>,
<a class="reference internal" href="../../glossary.html#term-predict-proba"><span class="xref std std-term">predict_proba</span></a>, or <a class="reference internal" href="../../glossary.html#term-decision-function"><span class="xref std std-term">decision_function</span></a>.
Multioutput-multiclass classifiers are not supported.</p>
</dd>
<dt><strong>X</strong><span class="classifier">{array-like or dataframe} of shape (n_samples, n_features)</span></dt><dd><p>The data to use to build the grid of values on which the dependence
will be evaluated. This is usually the training data.</p>
</dd>
<dt><strong>features</strong><span class="classifier">list of {int, str, pair of int, pair of str}</span></dt><dd><p>The target features for which to create the PDPs.
If features[i] is an int or a string, a one-way PDP is created; if
features[i] is a tuple, a two-way PDP is created. Each tuple must be
of size 2.
if any entry is a string, then it must be in <code class="docutils literal notranslate"><span class="pre">feature_names</span></code>.</p>
</dd>
<dt><strong>feature_names</strong><span class="classifier">array-like of shape (n_features,), dtype=str, default=None</span></dt><dd><p>Name of each feature; feature_names[i] holds the name of the feature
with index i.
By default, the name of the feature corresponds to their numerical
index for NumPy array and their column name for pandas dataframe.</p>
</dd>
<dt><strong>target</strong><span class="classifier">int, optional (default=None)</span></dt><dd><ul class="simple">
<li><p>In a multiclass setting, specifies the class for which the PDPs
should be computed. Note that for binary classification, the
positive class (index 1) is always used.</p></li>
<li><p>In a multioutput setting, specifies the task for which the PDPs
should be computed.</p></li>
</ul>
<p>Ignored in binary classification or classical regression settings.</p>
</dd>
<dt><strong>response_method</strong><span class="classifier">‘auto’, ‘predict_proba’ or ‘decision_function’,             optional (default=’auto’)</span></dt><dd><p>Specifies whether to use <a class="reference internal" href="../../glossary.html#term-predict-proba"><span class="xref std std-term">predict_proba</span></a> or
<a class="reference internal" href="../../glossary.html#term-decision-function"><span class="xref std std-term">decision_function</span></a> as the target response. For regressors
this parameter is ignored and the response is always the output of
<a class="reference internal" href="../../glossary.html#term-predict"><span class="xref std std-term">predict</span></a>. By default, <a class="reference internal" href="../../glossary.html#term-predict-proba"><span class="xref std std-term">predict_proba</span></a> is tried first
and we revert to <a class="reference internal" href="../../glossary.html#term-decision-function"><span class="xref std std-term">decision_function</span></a> if it doesn’t exist. If
<code class="docutils literal notranslate"><span class="pre">method</span></code> is ‘recursion’, the response is always the output of
<a class="reference internal" href="../../glossary.html#term-decision-function"><span class="xref std std-term">decision_function</span></a>.</p>
</dd>
<dt><strong>n_cols</strong><span class="classifier">int, optional (default=3)</span></dt><dd><p>The maximum number of columns in the grid plot. Only active when <code class="docutils literal notranslate"><span class="pre">ax</span></code>
is a single axis or <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd>
<dt><strong>grid_resolution</strong><span class="classifier">int, optional (default=100)</span></dt><dd><p>The number of equally spaced points on the axes of the plots, for each
target feature.</p>
</dd>
<dt><strong>percentiles</strong><span class="classifier">tuple of float, optional (default=(0.05, 0.95))</span></dt><dd><p>The lower and upper percentile used to create the extreme values
for the PDP axes. Must be in [0, 1].</p>
</dd>
<dt><strong>method</strong><span class="classifier">str, optional (default=’auto’)</span></dt><dd><p>The method to use to calculate the partial dependence predictions:</p>
<ul class="simple">
<li><p>‘recursion’ is only supported for gradient boosting estimator (namely
<a class="reference internal" href="sklearn.ensemble.GradientBoostingClassifier.html#sklearn.ensemble.GradientBoostingClassifier" title="sklearn.ensemble.GradientBoostingClassifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">GradientBoostingClassifier</span></code></a>,
<a class="reference internal" href="sklearn.ensemble.GradientBoostingRegressor.html#sklearn.ensemble.GradientBoostingRegressor" title="sklearn.ensemble.GradientBoostingRegressor"><code class="xref py py-class docutils literal notranslate"><span class="pre">GradientBoostingRegressor</span></code></a>,
<a class="reference internal" href="sklearn.ensemble.HistGradientBoostingClassifier.html#sklearn.ensemble.HistGradientBoostingClassifier" title="sklearn.ensemble.HistGradientBoostingClassifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">HistGradientBoostingClassifier</span></code></a>,
<a class="reference internal" href="sklearn.ensemble.HistGradientBoostingRegressor.html#sklearn.ensemble.HistGradientBoostingRegressor" title="sklearn.ensemble.HistGradientBoostingRegressor"><code class="xref py py-class docutils literal notranslate"><span class="pre">HistGradientBoostingRegressor</span></code></a>)
but is more efficient in terms of speed.
With this method, <code class="docutils literal notranslate"><span class="pre">X</span></code> is optional and is only used to build the
grid and the partial dependences are computed using the training
data. This method does not account for the <code class="docutils literal notranslate"><span class="pre">init</span></code> predictor of
the boosting process, which may lead to incorrect values (see
warning below. With this method, the target response of a
classifier is always the decision function, not the predicted
probabilities.</p></li>
<li><p>‘brute’ is supported for any estimator, but is more
computationally intensive.</p></li>
<li><p>‘auto’:
- ‘recursion’ is used for estimators that supports it.
- ‘brute’ is used for all other estimators.</p></li>
</ul>
</dd>
<dt><strong>n_jobs</strong><span class="classifier">int, optional (default=None)</span></dt><dd><p>The number of CPUs to use to compute the partial dependences.
<code class="docutils literal notranslate"><span class="pre">None</span></code> means 1 unless in a <a class="reference external" href="https://joblib.readthedocs.io/en/latest/parallel.html#joblib.parallel_backend" title="(in joblib v0.14.1.dev0)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">joblib.parallel_backend</span></code></a> context.
<code class="docutils literal notranslate"><span class="pre">-1</span></code> means using all processors. See <a class="reference internal" href="../../glossary.html#term-n-jobs"><span class="xref std std-term">Glossary</span></a>
for more details.</p>
</dd>
<dt><strong>verbose</strong><span class="classifier">int, optional (default=0)</span></dt><dd><p>Verbose output during PD computations.</p>
</dd>
<dt><strong>fig</strong><span class="classifier">Matplotlib figure object, optional (default=None)</span></dt><dd><p>A figure object onto which the plots will be drawn, after the figure
has been cleared. By default, a new one is created.</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 0.22: </span><code class="docutils literal notranslate"><span class="pre">fig</span></code> will be removed in 0.24.</p>
</div>
</dd>
<dt><strong>line_kw</strong><span class="classifier">dict, optional</span></dt><dd><p>Dict with keywords passed to the <code class="docutils literal notranslate"><span class="pre">matplotlib.pyplot.plot</span></code> call.
For one-way partial dependence plots.</p>
</dd>
<dt><strong>contour_kw</strong><span class="classifier">dict, optional</span></dt><dd><p>Dict with keywords passed to the <code class="docutils literal notranslate"><span class="pre">matplotlib.pyplot.contourf</span></code> call.
For two-way partial dependence plots.</p>
</dd>
<dt><strong>ax</strong><span class="classifier">Matplotlib axes or array-like of Matplotlib axes, default=None</span></dt><dd><ul class="simple">
<li><dl class="simple">
<dt>If a single axis is passed in, it is treated as a bounding axes</dt><dd><p>and a grid of partial dependence plots will be drawn within
these bounds. The <code class="docutils literal notranslate"><span class="pre">n_cols</span></code> parameter controls the number of
columns in the grid.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>If an array-like of axes are passed in, the partial dependence</dt><dd><p>plots will be drawn directly into these axes.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>If <code class="docutils literal notranslate"><span class="pre">None</span></code>, a figure and a bounding axes is created and treated</dt><dd><p>as the single axes case.</p>
</dd>
</dl>
</li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">New in version 0.22.</span></p>
</div>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt>display: <a class="reference internal" href="sklearn.inspection.PartialDependenceDisplay.html#sklearn.inspection.PartialDependenceDisplay" title="sklearn.inspection.PartialDependenceDisplay"><code class="xref py py-class docutils literal notranslate"><span class="pre">PartialDependenceDisplay</span></code></a></dt><dd></dd>
</dl>
</dd>
</dl>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>The ‘recursion’ method only works for gradient boosting estimators, and
unlike the ‘brute’ method, it does not account for the <code class="docutils literal notranslate"><span class="pre">init</span></code>
predictor of the boosting process. In practice this will produce the
same values as ‘brute’ up to a constant offset in the target response,
provided that <code class="docutils literal notranslate"><span class="pre">init</span></code> is a consant estimator (which is the default).
However, as soon as <code class="docutils literal notranslate"><span class="pre">init</span></code> is not a constant estimator, the partial
dependence values are incorrect for ‘recursion’. This is not relevant for
<a class="reference internal" href="sklearn.ensemble.HistGradientBoostingClassifier.html#sklearn.ensemble.HistGradientBoostingClassifier" title="sklearn.ensemble.HistGradientBoostingClassifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">HistGradientBoostingClassifier</span></code></a> and
<a class="reference internal" href="sklearn.ensemble.HistGradientBoostingRegressor.html#sklearn.ensemble.HistGradientBoostingRegressor" title="sklearn.ensemble.HistGradientBoostingRegressor"><code class="xref py py-class docutils literal notranslate"><span class="pre">HistGradientBoostingRegressor</span></code></a>, which do not have an
<code class="docutils literal notranslate"><span class="pre">init</span></code> parameter.</p>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="sklearn.inspection.partial_dependence.html#sklearn.inspection.partial_dependence" title="sklearn.inspection.partial_dependence"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sklearn.inspection.partial_dependence</span></code></a></dt><dd><p>Return raw partial dependence values</p>
</dd>
</dl>
</div>
<p class="rubric">Examples</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.datasets</span> <span class="kn">import</span> <span class="n">make_friedman1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.ensemble</span> <span class="kn">import</span> <span class="n">GradientBoostingRegressor</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">X</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">make_friedman1</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">clf</span> <span class="o">=</span> <span class="n">GradientBoostingRegressor</span><span class="p">(</span><span class="n">n_estimators</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">X</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">plot_partial_dependence</span><span class="p">(</span><span class="n">clf</span><span class="p">,</span> <span class="n">X</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span> <span class="c1">#doctest: +SKIP</span>
</pre></div>
</div>
</dd></dl>

<div class="section" id="examples-using-sklearn-inspection-plot-partial-dependence">
<h2>Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.inspection.plot_partial_dependence</span></code><a class="headerlink" href="#examples-using-sklearn-inspection-plot-partial-dependence" title="Permalink to this headline">¶</a></h2>
<div class="sphx-glr-thumbcontainer" tooltip="    See also sphx_glr_auto_examples_plot_roc_curve_visualization_api.py"><div class="figure align-default" id="id1">
<img alt="../../_images/sphx_glr_plot_partial_dependence_visualization_api_thumb.png" src="../../_images/sphx_glr_plot_partial_dependence_visualization_api_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/plot_partial_dependence_visualization_api.html#sphx-glr-auto-examples-plot-partial-dependence-visualization-api-py"><span class="std std-ref">Advanced Plotting With Partial Dependence</span></a></span><a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Partial dependence plots show the dependence between the target function [2]_ and a set of &#x27;tar..."><div class="figure align-default" id="id2">
<img alt="../../_images/sphx_glr_plot_partial_dependence_thumb.png" src="../../_images/sphx_glr_plot_partial_dependence_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/inspection/plot_partial_dependence.html#sphx-glr-auto-examples-inspection-plot-partial-dependence-py"><span class="std std-ref">Partial Dependence Plots</span></a></span><a class="headerlink" href="#id2" title="Permalink to this image">¶</a></p>
</div>
</div><div class="clearer"></div></div>
</div>


      </div>
    <div class="container">
      <footer class="sk-content-footer">
            &copy; 2007 - 2019, scikit-learn developers (BSD License).
          <a href="../../_sources/modules/generated/sklearn.inspection.plot_partial_dependence.rst.txt" rel="nofollow">Show this page source</a>
      </footer>
    </div>
  </div>
</div>
<script src="../../_static/js/vendor/bootstrap.min.js"></script>

<script>
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    ga('create', 'UA-22606712-2', 'auto');
    ga('set', 'anonymizeIp', true);
    ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>


<script>
$(document).ready(function() {
    /* Add a [>>>] button on the top-right corner of code samples to hide
     * the >>> and ... prompts and the output and thus make the code
     * copyable. */
    var div = $('.highlight-python .highlight,' +
                '.highlight-python3 .highlight,' +
                '.highlight-pycon .highlight,' +
		'.highlight-default .highlight')
    var pre = div.find('pre');

    // get the styles from the current theme
    pre.parent().parent().css('position', 'relative');
    var hide_text = 'Hide prompts and outputs';
    var show_text = 'Show prompts and outputs';

    // create and add the button to all the code blocks that contain >>>
    div.each(function(index) {
        var jthis = $(this);
        if (jthis.find('.gp').length > 0) {
            var button = $('<span class="copybutton">&gt;&gt;&gt;</span>');
            button.attr('title', hide_text);
            button.data('hidden', 'false');
            jthis.prepend(button);
        }
        // tracebacks (.gt) contain bare text elements that need to be
        // wrapped in a span to work with .nextUntil() (see later)
        jthis.find('pre:has(.gt)').contents().filter(function() {
            return ((this.nodeType == 3) && (this.data.trim().length > 0));
        }).wrap('<span>');
    });

    // define the behavior of the button when it's clicked
    $('.copybutton').click(function(e){
        e.preventDefault();
        var button = $(this);
        if (button.data('hidden') === 'false') {
            // hide the code output
            button.parent().find('.go, .gp, .gt').hide();
            button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden');
            button.css('text-decoration', 'line-through');
            button.attr('title', show_text);
            button.data('hidden', 'true');
        } else {
            // show the code output
            button.parent().find('.go, .gp, .gt').show();
            button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible');
            button.css('text-decoration', 'none');
            button.attr('title', hide_text);
            button.data('hidden', 'false');
        }
    });

	/*** Add permalink buttons next to glossary terms ***/
	$('dl.glossary > dt[id]').append(function() {
		return ('<a class="headerlink" href="#' +
			    this.getAttribute('id') +
			    '" title="Permalink to this term">¶</a>');
	});
  /*** Hide navbar when scrolling down ***/
  // Returns true when headerlink target matches hash in url
  (function() {
    hashTargetOnTop = function() {
        var hash = window.location.hash;
        if ( hash.length < 2 ) { return false; }

        var target = document.getElementById( hash.slice(1) );
        if ( target === null ) { return false; }

        var top = target.getBoundingClientRect().top;
        return (top < 2) && (top > -2);
    };

    // Hide navbar on load if hash target is on top
    var navBar = document.getElementById("navbar");
    var navBarToggler = document.getElementById("sk-navbar-toggler");
    var navBarHeightHidden = "-" + navBar.getBoundingClientRect().height + "px";
    var $window = $(window);

    hideNavBar = function() {
        navBar.style.top = navBarHeightHidden;
    };

    showNavBar = function() {
        navBar.style.top = "0";
    }

    if (hashTargetOnTop()) {
        hideNavBar()
    }

    var prevScrollpos = window.pageYOffset;
    hideOnScroll = function(lastScrollTop) {
        if (($window.width() < 768) && (navBarToggler.getAttribute("aria-expanded") === 'true')) {
            return;
        }
        if (lastScrollTop > 2 && (prevScrollpos <= lastScrollTop) || hashTargetOnTop()){
            hideNavBar()
        } else {
            showNavBar()
        }
        prevScrollpos = lastScrollTop;
    };

    /*** high preformance scroll event listener***/
    var raf = window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        window.oRequestAnimationFrame;
    var lastScrollTop = $window.scrollTop();

    if (raf) {
        loop();
    }

    function loop() {
        var scrollTop = $window.scrollTop();
        if (lastScrollTop === scrollTop) {
            raf(loop);
            return;
        } else {
            lastScrollTop = scrollTop;
            hideOnScroll(lastScrollTop);
            raf(loop);
        }
    }
  })();
});

</script>
    
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
    
</body>
</html>